<template>
  <div class="about">
    <h1>This is an about page</h1>
    <p>当前动态参数：{{ username }}</p>
    <p>
      <router-link to="/about/jack">jack</router-link>
      <router-link to="/about/lily">lily</router-link>
    </p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: "",
    };
  },
  watch: {
    $route() {
      this.username = this.$route.params.user;
    },
  },
  created() {
    // this.username = sessionStorage.getItem("username");
    console.log("组件初始化完成");
    this.username = this.$route.params.user;
  },
};
</script>
